<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>工厂函数</title>
    <script>
        function createCar(name,he,price,state){
            var car=new Object();
            car.name=name;
            car.he=he;
            car.price=price;
            car.state=state;
            car.run=function(){
                console.log(this.name+" 目前还"+this.he+"合格证  建议零售价"+this.price+"  说明书为"+this.state)
            }
            return car;
        }
        var car1=createCar("QQ","没有","10000","这是一款品牌车");
        car1.run();
    </script>
</head>
<body>

</body>
</html>